package decorator
{
	public class WordReader extends AbstractReaderDecorator
	{
		private var _words:Array;
		public function WordReader(reader:IReader)
		{
			super(reader);
			
			var expression:RegExp = /[a-z]+/ig;
			
			_words = readString().match(expression);
		}
		override public function read():String{
			var word:String = _words[index++];
			return word;
		}
		override public function readArray(offset:uint=0, length:uint=0):Array{
			return _words.slice(offset,length);
		}
		override public function hasNext():Boolean{
			return index < _words.length;
		}
		
		
	}
}